package org.black.phoneUtility.sms.schedule.app.fragment;

import org.black.phoneUtility.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;

public class SmsScheduleChooseTagDialogFragment extends DialogFragment
		implements DialogInterface.OnClickListener {

	public static final String TAG = SmsScheduleChooseTagDialogFragment.class
			.getName();

	public interface SmsScheduleChooseTagDialogInterface {
		public void onChooseSmsScheduleChooseTagDialogName();

		public void onChooseSmsScheduleChooseTagDialogFirstName();

		public void onChooseSmsScheduleChooseTagDialogNickName();
	}

	private SmsScheduleChooseTagDialogInterface smsScheduleChooseTagDialogInterface;

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		builder.setTitle(R.string.sms_message_add_edit_insert_tags_title)
				.setItems(R.array.sms_message_add_edit_insert_tags_array, this);
		return builder.create();
	}

	@Override
	public void onClick(DialogInterface dialog, int which) {
		switch (which) {
		case 0:
			this.smsScheduleChooseTagDialogInterface
					.onChooseSmsScheduleChooseTagDialogName();
			break;
		case 1:
			this.smsScheduleChooseTagDialogInterface
					.onChooseSmsScheduleChooseTagDialogFirstName();
			break;
		case 2:
			this.smsScheduleChooseTagDialogInterface
					.onChooseSmsScheduleChooseTagDialogNickName();
			break;
		}

	}

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		try {
			smsScheduleChooseTagDialogInterface = (SmsScheduleChooseTagDialogInterface) activity;
		} catch (ClassCastException e) {
			throw new ClassCastException(activity.toString()
					+ " must implement SmsScheduleChooseTagDialogInterface");
		}
	}
}
